{% extends "master.html" %}
{% from "_formhelpers.html" import render_field_in_row %}

{% block title %}New Site{% endblock %}
{%block tag %}home{% endblock %}

{% block header %}
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"
  rel="stylesheet">
{% endblock %}

{% block content %}
<h2>Information site: {{ site.name }}</h2>

Created at: {{ site.created_at }} <br />
Created by: {{ site.created_by }}

<h3>Export compliance</h3>
<p>
  By downloading Fedora software, you acknowledge that you understand all of
  the following: Fedora software and technical information may be subject to
  the U.S. Export Administration Regulations (the “EAR”) and other U.S. and
  foreign laws and may not be exported, re-exported or transferred
  (a) to any country listed in Country Group E:1 in Supplement No. 1 to part
  740 of the EAR (currently, Cuba, Iran, North Korea, Sudan and Syria);
  (b) to any prohibited destination or to any end user who has been prohibited
  from participating in U.S. export transactions by any federal agency of the
  U.S. government; or
  (c) for use in connection with the design, development or production of
  nuclear, chemical or biological weapons, or rocket systems, space launch
  vehicles, or sounding rockets, or unmanned air vehicle systems.
</p>

<p>
  You may not download Fedora software or technical information if you are
  located in one of these countries or otherwise subject to these restrictions.
  You may not provide Fedora software or technical information to individuals
  or entities located in one of these countries or otherwise subject to these
  restrictions. You are also responsible for compliance with foreign law
  requirements applicable to the import, export and use of Fedora software
  and technical information.
</p>

<form action="" method="POST">
  <table>
    {{ render_field_in_row(form.name) }}
    {{ render_field_in_row(form.password) }}
    {{ render_field_in_row(form.org_url) }}
    {{ render_field_in_row(form.private) }}
    {% if is_admin %}
    {{ render_field_in_row(form.admin_active) }}
    {% endif %}
    {{ render_field_in_row(form.user_active) }}
    {{ render_field_in_row(form.all_sites_can_pull_from_me) }}
    {{ render_field_in_row(form.downstream_comments) }}
  </table>
  <p class="buttons indent">
    <input type="submit" class="submit positive button" value="Update">
    {{ form.csrf_token }}
  </p>
</form>

<table>
  <tr>
    <th class="matrix_section" rowspan="{{ site.admins | length or 1}}">
      Admins <a href="{{ url_for('siteadmin_new', site_id=site.id) }}">[add]</a>
    </th>
    {% for admin in site.admins %}
    {% if not loop.first %}
    </tr>
    <tr>
    {% endif %}
      <td class="matrix_section {{ loop.cycle('matrix_odd', 'matrix_even') }}">
      <form class="icon" method="POST"
        action="{{ url_for('siteadmin_delete', site_id=site.id, admin_id=admin.id) }}">
          {{ admin.username }}
          {{ form.csrf_token }}
          <button
            onclick="return confirm('You sure you want to delete this admin?');"
            title="Delete Site Admin">
            <span class="icon icon-trash blue"></span>
          </button>
        </form>
      </td>
    {% endfor %}
  </tr>
  <tr>
    <th rowspan="{{ site.hosts | length or 1}}" class="matrix_section">
      Hosts <a href="{{ url_for('host_new', site_id=site.id) }}">[add]</a>
    </th>
      {% for host in site.hosts %}
      {% if not loop.first %}
      </tr>
      <tr>
      {% endif %}
      <td class="matrix_section {{ loop.cycle('matrix_odd', 'matrix_even') }}">
        <a href="{{ url_for('host_view', host_id=host.id) }}">
        {{ host.name }}</a> <br />
      </td>
      {% else %}
      <td></td>
      {% endfor %}
  </tr>
  <tr>
      <th>Delete site</th>
      <td>
        <form class="icon inline" method="POST"
          action="{{ url_for('site_drop', site_id=site.id) }}">
        {{ form.csrf_token }}
          <button
            onclick="return confirm('You sure you want to delete this site?');"
            title="Delete site">
            <span class="icon icon-trash blue"></span>
            Delete
          </button>
        </form>
      </td>
  </tr>
</table>
{% endblock %}
